
#include <boost/spirit/core.hpp>
#include <boost/spirit/actor/push_back_actor.hpp>
#include <iostream>
#include <vector>
#include <string>


using namespace std;
using namespace boost::spirit;

void print_double(double d)
{
    cout << d << endl;
}

bool
parse_numbers(char const* str, vector<double>& v)
{
    return parse(str,
        //  Begin grammar
        (
            real_p[&print_double] >> *(',' >> real_p[&print_double])
        )
        ,
        //  End grammar
        space_p).full;
}

int main()
{
    vector<double> v;
    parse_numbers("   1.2 ,3.4,     5.6", v);
    cout << "Bye... :-) \n\n";

    rule<> h = str_p ("hello1");
    rule<> w = str_p ("hello2");

    if (parse("hello2", h&w).full)
    {
        cout << "Success" << endl;
    }
    else
    {
        cout << "Fail" << endl;
    }
    
    
    return 0;

    
}
